<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<link rel="stylesheet" type="text/css" href="/css/modules/logoin.css"/>
	<script src="../libs/js/utils.js" type="text/javascript" charset="utf-8"></script>
	<body>
		<header>
			<div class="content-center">
				<a class="logo" href="">
				    <div class="logo-img"></div>
				    <span class="logo-name">黑鲨商城</span>
				</a>
			</div>
		</header>
		
		<div class="background-center">
			<div class="content-center">
			    <div class="login">
			        <p class="title">账号登录</p>
			        <div class="form">
			            <div class="form-group">
			                <input type="text" class="form-control" id="mobile" maxlength="11" placeholder="请输入手机号">
			            </div>
			            <div class="form-group">
			                <input type="password" class="form-control" id="passwd" placeholder="请输入密码">
			            </div>
			        </div>
			        <div class="btn-col">
			            <div class="btn-l btn-green" id="login-btn">登录</div>
			        </div>
			        <div class="tool-bar">
			            <div class="tool-bar-left">
			                <!-- <a data-logintype="/xiaomi/auth">小米登录</a> -->
							<a href="" class="xiaomi">小米登录</a>
			            </div>
			            <div class="tool-bar-right">
			                <a href="/html/register.html" id="reg" target="_self">立即注册</a>
			                <a href="repwd.html" target="_self">忘记密码</a>
			            </div>
			        </div>
			        <div class="login-other">
			            <p class="title">其他登陆方式</p>
			            <div class="login-item-list">
			                <a class="login-item icon-qq" data-logintype="/qq/auth"></a>
			                <a class="login-item icon-wechat" data-logintype="/weixin/auth?type=2"></a>
			                <a class="login-item icon-alipay" data-logintype="/alipay/auth"></a>
			                <a class="login-item icon-weibo" data-logintype="/weibo/auth"></a>
			            </div>
			        </div>
			    </div>
			</div>
		</div>
	
	
	<footer class="footer">
	    <div class="content-center">
	        <div class="copyright">
	            <p>赣公网安备36010602000042 | Copyright © 2017-2018  BlackShark 赣ICP备17012659号. All Rights Reserved.</p>
	        </div>
		</div>
	</footer>
	
	
	
	<script type="text/javascript">
		var form = document.querySelector('.btn-col')
		var nameInput = document.querySelector('#mobile')
		var pwdInput = document.querySelector('#passwd')
		// var check = document.querySelector('#check')
		
		form.addEventListener('click',function(e){
			e.preventDefault()
			const name = nameInput.value
			const pwd = pwdInput.value
			utils.post('http://localhost/black-shark/gulp-project/src/api/login.php', {name,pwd},resp => {		//resp这里是参数，箭头函数只有一个参数时可以省略括号和函数名，resp对应的是utils里的data
				if(resp.code ===200){
					utils.setCookie('name',name,{expires:7,path:'/'})
					alert(resp.body.msg + ',即将回到首页')
					location.replace('./list.html')
				}else{
					alert(resp.body.msg)
				}
			})
		})
	</script>
	</body>
</html>
